//
//  JYTabBarController.m
//  client
//
//  Created by ld on 2017/6/27.
//
//

#import "JYTabBarController.h"
#import "HomeViewController.h"

@interface JYTabBarController ()

@property (nonatomic, strong) HomeViewController *homeVC;
@property (nonatomic, strong) HomeViewController *orderVC;
@property (nonatomic, strong) HomeViewController *meVC;

@end

@implementation JYTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.viewControllers = @[[[UINavigationController alloc] initWithRootViewController:self.homeVC], [[UINavigationController alloc] initWithRootViewController:self.orderVC], [[UINavigationController alloc] initWithRootViewController:self.meVC]];
}

- (HomeViewController *)homeVC {
    if (!_homeVC) {
        _homeVC = [[HomeViewController alloc] init];
        _homeVC.menuItem = MenuItemHome;
        _homeVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"马上下单" image:[UIImage imageNamed:@"home"] selectedImage:[UIImage imageNamed:@"home_selected"]];
    }
    return _homeVC;
}

- (HomeViewController *)orderVC {
    if (!_orderVC) {
        _orderVC = [[HomeViewController alloc] init];
        _orderVC.menuItem = MenuItemOrder;
        _orderVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"订单" image:[UIImage imageNamed:@"order"] selectedImage:[UIImage imageNamed:@"order_selected"]];
    }
    return _orderVC;
}

- (HomeViewController *)meVC {
    if (!_meVC) {
        _meVC = [[HomeViewController alloc] init];
        _meVC.menuItem = MenuItemMe;
        _meVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"me"] selectedImage:[UIImage imageNamed:@"me_selected"]];
    }
    return _meVC;
}

@end
